package com.schedule;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Calendar;
import java.util.Date;

@Component
public class ScheduledTasks {
	

		// 五秒钟一次，默认单线程的，每次任务执行完后，再等五秒钟开始执行下一次
//	    @Scheduled(cron="*/5 * * * * ?")
	    public void reportCurrentTime() throws Exception {
//	        Thread.sleep(1000);
			Calendar calendar=Calendar.getInstance();
			Date time = calendar.getTime();
			System.out.println(time);
	    }
}
